package com.kk.responsibilitychain;

import com.kk.responsibilitychain.request.PurchaseRequest;

public class DepartmentApprover extends Approver {
    public DepartmentApprover(String name) {
        super(name);
    }

    @Override
    public void processRequest(PurchaseRequest purchaseRequest) {
        if (purchaseRequest.getPrice() >= 0 && purchaseRequest.getPrice() <= 5000) {
            System.out.println("请求编号：" + purchaseRequest.getId() + ", 审批" + purchaseRequest.getPrice() + "元, 被" + this.name + "处理了！");
        } else {
            System.out.println("请求编号：" + purchaseRequest.getId() + ", 审批" + purchaseRequest.getPrice() + "元, 无法被" + this.name + "处理，该请求将往上申请。。。");
            approver.processRequest(purchaseRequest);
        }
    }
}
